package cn.blunce;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class DBGen {

    public static void main(String[] args) throws Exception {
        Schema schema = new Schema(1, "cn.blunce.greendaoinandroidstudio.models");

        addPerson(schema);
        addJob(schema);

        schema.enableKeepSectionsByDefault();//add custom code

        new DaoGenerator().generateAll(schema, "../app/src/main/java");
    }

    private static void addPerson(Schema schema) {
        Entity entity = schema.addEntity("Person");
        entity.addIdProperty();
        entity.addStringProperty("name");
        entity.addIntProperty("age");
    }

    private static void addJob(Schema schema) {
        Entity entity = schema.addEntity("Job");
        entity.addStringProperty("category").primaryKey();
        entity.addStringProperty("content");
    }
}